package com.mondo.financialwallet.presentation.ui.fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;

import com.example.common.ui.BaseFragment;
import com.mondo.financialwallet.R;
import com.mondo.financialwallet.presentation.model.DAppInfoModel;
import com.mondo.financialwallet.presentation.ui.adapter.SimpleDAppAdapter;

import java.util.ArrayList;

import butterknife.Bind;

public class DAppListFragment extends BaseFragment {

    private static final String KEY_KEY = "KEY";

    public static Fragment create(ArrayList<DAppInfoModel> apps) {
        DAppListFragment fragment = new DAppListFragment();
        Bundle arguments = new Bundle();
        arguments.putParcelableArrayList(KEY_KEY, apps);
        fragment.setArguments(arguments);
        return fragment;
    }

    @Bind(R.id.app_list) RecyclerView mAppList;

    @Override
    protected int getLayoutID() {
        return R.layout.fragment_dapp_list;
    }

    @Override
    protected void initActions() {
        ArrayList<DAppInfoModel> apps = (ArrayList<DAppInfoModel>) getArguments().get(KEY_KEY);
        mAppList.setAdapter(SimpleDAppAdapter.createDetails(apps));
    }
}
